#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stack>
using namespace std;

class Solution {
public:
    int clumsy(int N) {
        stack<int> T;
        vector<int> temp;
        int status = 1;
        int sum  =0;
        for(int i = N;i>=1;--i){
            T.push(i);
            if(T.size()==2){
                //判断是*，/，+，-中的哪一个
                int a = T.top();
                T.pop();
                int b = T.top();
                T.pop();
                if(status%3==1){
                    T.push(b*a);
                }
                else if(status%3==2){
                    T.push(b/a);
                }
                else if(status%3==0){
                    temp.push_back(b);
                    sum = sum+a;
                }
                
                ++status;
            }
        }
        if(!T.empty()){
            temp.push_back(T.top());
        }
        int result = temp[0];
        for(int i = 1;i<temp.size();++i){
            result -= temp[i];
        }
        return result+sum;
    }

};

int main(){
    Solution S;
    cout<<S.clumsy(10)<<endl;
}